package top.gjn998.condition.component;

import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import top.gjn998.condition.bean.GjnSystem;

/**
 * @Author 郭泽鹏
 * @Date 2021/11/19 23:33
 * @Version 1.0
 * @Description 返回系统信息
 * 测试 Condition 注解
 */
@Component      //需要丢到容器里面
//@ConditionalOnProperty(name = "app.public", havingValue = "true")      //配置值的条件
//@ConditionalOnProperty(name = {"app.public", "app.vip"}, havingValue = "true")
@ConditionalOnExpression("'${app.vip}'.equals('high')&&${app.public:true}")
public class SystemComp {
    public GjnSystem getSystemBySid() {
        return new GjnSystem("1001", "新核心");
    }
}
